/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.adama.entite;

import fr.adama.entite.typePerso.EtatFacture;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.UniqueConstraint;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;

/**
 *
 * @author mini-john
 */
@Entity
@Indexed
@Table(uniqueConstraints = @UniqueConstraint(name = "FACTUREEXIST", columnNames = {"contrat_id", "periode"}))
@Analyzer(impl = org.apache.lucene.analysis.standard.StandardAnalyzer.class)
public class Facture {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "facture_sequence")
    @SequenceGenerator(name = "facture_sequence", sequenceName = "facture_sequence")
    private Long id;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date periode;
    private Integer mois;
    private Integer annee;
   
    @ManyToOne
    @IndexedEmbedded
    private Contrat contrat;
    @Field()
    private String numero;
    @Enumerated(EnumType.STRING)
    private EtatFacture etatFacture;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getPeriode() {
        return periode;
    }

    public void setPeriode(Date periode) {
        this.periode = periode;
    }

    public Integer getMois() {
        return mois;
    }

    public void setMois(Integer mois) {
        this.mois = mois;
    }

    public Integer getAnnee() {
        return annee;
    }

    public void setAnnee(Integer annee) {
        this.annee = annee;
    }

  
    public String getNumero() {
        return numero;
    }

    public void setNumero(String numero) {
        this.numero = numero;
    }

    public EtatFacture getEtatFacture() {
        return etatFacture;
    }

    public void setEtatFacture(EtatFacture etatFacture) {
        this.etatFacture = etatFacture;
    }

    public Contrat getContrat() {
        return contrat;
    }

    public void setContrat(Contrat contrat) {
        this.contrat = contrat;
    }

}
